'use strict';

const db = uniCloud.database();
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	let res =  await db.collection("userpublish").where({_id:event.id})
	.get();
	
	 res.data = res.data.map(item => {
	    return {
	      ...item,
	      id: item._id,
	      _id: undefined // 删除原来的_id字段
	    };
	  });
	  return res;
};
